<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="${base}/favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
<link href="${base}/css/materialdesignicons.min.css" rel="stylesheet">
<link href="${base}/css/style.min.css" rel="stylesheet">
</head>
  
<body>
<div class="container-fluid">
  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          <label style="font-size: 30px">帖子类型管理</label>
          <form action="${base}/postType/deleteAll" method="post" onsubmit="return check()" target="mainView">
            <div class="card-toolbar clearfix">
              <div class="toolbar-btn-action">
                <a class="btn btn-primary m-r-5" href="${base}/postType/toAdd" target="mainView"><i class="mdi mdi-plus"></i>新增</a>
                <button  class="btn btn-danger"><i class="mdi mdi-window-close" ></i>批量删除</button>
              </div>
            </div>
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                  <tr>
                    <th>
                      <label class="lyear-checkbox checkbox-primary">
                        <input type="checkbox" id="check-all"><span></span>
                      </label>
                    </th>
                    <th>编号</th>
                    <th>帖子类型</th>
                    <th>操作</th>
                  </tr>
              </thead>
              <tbody>
              <c:forEach var="pt" items="${pt.list}">
              <tr>
                <td>
                  <label class="lyear-checkbox checkbox-primary">
                    <input type="checkbox" name="ids" value="${pt.id}"><span></span>
                  </label>
                </td>
                <td>${pt.id}</td>
                <td>${pt.type}</td>
                <td>
                  <div class="btn-group">
                    <a class="btn btn-xs btn-default" href="${base}/postType/toUpdate?id=${pt.id}" title="编辑" target="mainView" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                    <a class="btn btn-xs btn-default" onclick="return confirm('确认删除?')" href="${base}/postType/delete?id=${pt.id}" title="删除" target="mainView" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                  </div>
                </td>
              </tr>
              </c:forEach>
              </tbody>
            </table>
          </div>
          </form>
          <ul class="pagination">
            <li><span><a href="${base}/postType/show?pageNum=${pt.prePage}">«</a></span></li>
            <c:forEach var="i" items="${pt.navigatepageNums}">
              <li <c:if test="${i eq pt.pageNum}">class="active"</c:if>>
                <a href="${base}/postType/show?pageNum=${i}">${i}</a>
              </li>
            </c:forEach>
            <li><span><a href="${base}/postType/show?pageNum=${pt.nextPage}">»</a></span></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript" src="${base}/js/jquery.min.js"></script>
<script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${base}/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${base}/js/main.min.js"></script>
<script type="text/javascript">
  function check() {
    var check=false;
    var ids=document.getElementsByName("ids");
    for(let i=0;i<ids.length;i++){
      if (ids[i].checked){
        check=confirm("是否删除选中帖子类型");
        if(check){
          return true;
        }else {
          return false;
        }
      }
    }
    return false;
  }


$(function(){
    $('.search-bar .dropdown-menu a').click(function() {
        var field = $(this).data('field') || '';
        $('#search-field').val(field);
        $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
    });
});
</script>
</body>
</html>